package com.cy.pj.common.pojo;

/**
 * @author Cx
 * @stage secondStageOfWeb
 * @creat 2020-11-09 16:51
 * 封装服务端响应到客户端结果
 * 基于此对象定义响应规范
 * 便于后续统一处理
 */
public class ResponseResult {

    private Integer state = 1; /* 响应状态码 1==ok 0==error */
    private String message = "OK"; /* 响应具体信息 */
    private Object data; /* 响应数据 (一般是查询时获取到的正确数据) */

    public ResponseResult() {
    }

    public ResponseResult(String message) {
        this.message = message;
    }

    public ResponseResult(Object data) {
        this.data = data;
    }

    public ResponseResult(Throwable e) {
        this.state = 0;
        this.message = e.getMessage();
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
